<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工作日志-工作日志</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <link rel="stylesheet" href="/css/custom.form.css">
    <style>
        .layui-disabled, .layui-disabled:hover {
            color: #000000 !important;
            cursor: not-allowed !important;
        }

        .layui-form-label {
            width: 100px;
        }

        .layui-input-block {
            margin-left: 130px;
        }

        .layui-input layui-unselect {
            cursor: pointer;
        }

        .layui-table {
            width: 96%;
        }

        .layui-input-inline {
            margin-left: 10px;
        }
    </style>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header"></div>
                <div class="layui-card-body">
                    <div class="panel panel-default operation" hidden>
                        <div class="panel-heading title"></div>
                        <div class="layui-tab">
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <form class="layui-form" action="" lay-filter="info">
                                        <input name="_tabKey" id="_tabKey" hidden>
                                        <input name="_jcajxxuuid" id="_jcajxxuuid" hidden>
                                        <div class="layui-form-item">

                                            <label class="layui-form-label">填报时间</label>
                                            <div class="layui-input-inline">
                                                <input type="text" readonly class="layui-input contentdate" id="contentdate"
                                                       placeholder="请输入填报日期">
                                            </div>

                                        </div>

                                        <div class="layui-form-item">
                                            <div id="moldDiv">
                                                <label class="layui-form-label">填报类型</label>
                                                <div class="layui-input-block">
                                                    <select lay-search="" name="mold" lay-filter="mold" id="mold">
                                                        <option value="">请选择填报类型</option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                        <div id="inspectionHearInfo">
                                            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
                                                <legend id="jcajbh"></legend>
                                            </fieldset>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">案件名称</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" id="ajmc" name="ajmc"
                                                           class="layui-input layui-disabled" disabled="ture">
                                                </div>

                                                <label class="layui-form-label">检查项目</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" id="jcxm" name="jcxm"
                                                           class="layui-input layui-disabled" disabled="ture">
                                                </div>
                                            </div>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">检查人</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" id="jcry" name="jcry"
                                                           class="layui-input layui-disabled" disabled="ture">
                                                </div>
                                            </div>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">纳税人名称</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" id="nsrmc" name="nsrmc"
                                                           class="layui-input layui-disabled" disabled="ture">
                                                </div>
                                                <label class="layui-form-label">纳税人识别号</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" id="nsrsbh" name="nsrsbh"
                                                           class="layui-input layui-disabled" disabled="ture">
                                                </div>
                                            </div>

                                        </div>
                                        <div id="denoWorkDiv">
                                            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
                                                <legend>完成工作</legend>
                                            </fieldset>

                                            <div class="layui-form-item">
                                                <div class="layui-input-block">
										<textarea rows="2" name="content1" id="content1"
                                                  placeholder="请输入反馈信息,1-500个字符" autocomplete="off"
                                                  class="layui-textarea"
                                                  onkeyup="javascript:texLength1(this, 'textarea_length1');"></textarea>
                                                    <span class="red" id="textarea_length1">0</span> / <span
                                                        class="num_count1">500</span>
                                                </div>
                                            </div>
                                        </div>
                                        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 5px;">
                                            <legend></legend>
                                        </fieldset>
                                        <div id="content2and3Div"></div>
                                        <fieldset class="layui-elem-field layui-field-title" id="bottomLine"
                                                  style="margin-top: 10px;"></fieldset>
                                        <div class="layui-form-item">
                                            <div class="layui-input-block">
                                                <button type="submit" class="layui-btn" id="saveWorkflowLog"
                                                        onclick="return false" lay-submit lay-filter="saveWorkflowLog">提交
                                                </button>
                                                <button class="layui-btn layui-btn-primary" id="btn_cancel">返回</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-tab table_div">
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <div class="layui-form-item">
                                    <div class="layui-input-inline">
                                        <input type="text" readonly class="layui-input" id="createTime" placeholder="创建时间">
                                    </div>
                                    <div class="layui-input-inline layui-form">
                                        <select id="logType">
                                            <option value="">日志类型</option>
                                            <option value="1">日常日志</option>
                                            <option value="2">案件日志</option>
                                        </select>
                                    </div>
                                    <div class="layui-input-inline ">
                                        <button class="layui-btn" onclick="searchLog()" id="searchLog">查询</button>
                                    </div>
                                </div>
                                <table class="layui-table" id="logShowTable" lay-filter="logShowTable"></table>
                                <div id="page"></div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-tab table_div1" hidden>
                        <div class="layui-tab-content">
                            <form class="layui-form" action="" lay-filter="info1">
                                <div class="layui-tab-item layui-show">
                                    <div class="layui-form-item">
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" id="nsrmcInput" placeholder="纳税人名称">
                                        </div>
                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" id="nsrsbhInput" placeholder="纳税人识别号">
                                        </div>

                                        <div class="layui-input-inline">
                                            <input type="text" class="layui-input" id="ajbhInput" placeholder="案件编号">
                                        </div>

                                        <div class="layui-input-inline" style="" id="ajztDm">
                                        </div>

                                        <div class="layui-input-inline ">
                                            <!-- <button class="layui-btn" id="search">查询</button> -->

                                            <button type="submit" class="layui-btn" id="search"
                                                    onclick="return false" lay-submit lay-filter="search">提交
                                            </button>

                                        </div>

                                    </div>
                                    <table class="layui-table" id="showTable" lay-filter="showTable"></table>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="logToolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="add">添加日常日志</button>
        <button class="layui-btn layui-btn-sm" lay-event="addinspectionhear">添加案件日志</button>
    </div>
</script>
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="cancel">返回</button>
    </div>
</script>
<script type="text/html" id="tool">
    <a class="layui-btn layui-btn-xs" lay-event="addinspectionhear">填写日志</a>
</script>
<script type="text/html" id="tool1">
    {{#  if(d.createFlag == "Y"){ }}
    <a class="layui-btn layui-btn-xs" lay-event="dellog">删除</a>
    {{#  } }}
    <!-- <a class="layui-btn layui-btn-xs" lay-event="editlog">修改</a> -->
</script>

<script src="/layui/layui.all.js"></script>
<script src="/layui-ext/selectM/selectM.js"></script>
<script src="/js/core.util.js"></script>
<script th:inline="none">
    // 获取token
    var token = CoreUtil.getData("access_token");
    // 地址栏转义token中的#号
    var tokenQuery = token.replace("#", "%23");
    var logShowTable;
    var showTable;
    var table = layui.table;
    var form = layui.form;
    var layer = layui.layer;
    var $ = jQuery = layui.jquery;
    var laydate = layui.laydate;
    var upload = layui.upload;
    var element = layui.element;
    var maxlength = 500;
    var inspectionMan = "";
    var mold = "";
    var contentdate = null;
    var startTime = null;
    var endTime = null;
    var _surveyDetail = [];
    var selectMAjcx = layui.selectM;
    layui.config({
        base: '/'
    }).extend({
        eleTree: 'layui-ext/eleTree/eleTree',
        selectM: 'layui-ext/selectM/selectM'
    }).use(['table', 'layer', 'laydate', 'upload', 'element'], function () {
        //下拉选
        form.on('select(mold)', function () {
            var myselect = document.getElementById("mold");
            var index = myselect.selectedIndex; // selectedIndex代表的是你所选中项的index
            mold = myselect.options[index].value;
            // 加载页面
            var mapArr = {
                id: mold
            }
            CoreUtil.sendPost("/workflow/log/survey/getSurveyById", mapArr, function (res) {
                if (res.code == '0') {

                    $("#content2and3Div").html("");
                    var _data = res.data;
                    _surveyDetail = _data;
                    var viewSurveyTmp = "";
                    for (var _i in _data) {

                        var _optionsConent = _data[_i].optionsConent;
                        var _contentSurveyJson = eval("(" + _optionsConent + ")");
                        var _optionsTitle = _data[_i].optionsTitle;
                        var _optionsType = _data[_i].optionsType;
                        var _id = _data[_i].id;
                        var _surveyId = _data[_i].surveyId;

                        if (_optionsType == "1") {
                            // 文本
                            viewSurveyTmp += "<div class='layui-form-item'>"
                                + "<label style='' class='layui-form-label'>" + _optionsTitle + "</label>"
                                + "<div class='layui-input-block'>";
                            if (_contentSurveyJson[0] == "date") {
                                viewSurveyTmp += "<input type='text' name='date' class='layui-date layui-input " + _id + "' placeholder='请输入yyyy-mm-dd格式'>";
                            } else {
                                viewSurveyTmp += "<input type='text' class='layui-input " + _id + "' placeholder='请输入'>";
                            }
                            viewSurveyTmp += "</div><br>";


                        } else if (_optionsType == "2") {
                            var l = Object.keys(_contentSurveyJson).length;
                            // 多选
                            viewSurveyTmp += "<div class='layui-form-item'>"
                                + "<label style='height: " + l * 60 + "px' class='layui-form-label'>" + _optionsTitle + "</label>";
                            for (var _ii in _contentSurveyJson) {
                                viewSurveyTmp += "<div onclick='optionsDuoxuan(this," + _ii + ")' class='layui-unselect layui-form-checkbox " + _id + "' lay-skin='primary'><div></div><i class='layui-icon layui-icon-ok'></i></div>" + _contentSurveyJson[_ii][0];
                                var flag = _contentSurveyJson[_ii][1];
                                if (flag) {
                                    viewSurveyTmp += "<input style='width: 40%' type='text' class='layui-input " + _id + "_" + _ii + "' placeholder='请输入'>";
                                }
                                viewSurveyTmp += "<br>";

                            }

                            viewSurveyTmp += "<hr>";

                        } else if (_optionsType == "3") {
                            var l = Object.keys(_contentSurveyJson).length;
                            // 单选
                            viewSurveyTmp += "<div class='layui-form-item'>"
                                + "<label style='height: " + l * 60 + "px' class='layui-form-label'>" + _optionsTitle + "</label>";

                            for (var _ii in _contentSurveyJson) {
                                viewSurveyTmp += "<div onclick='optionsDanxuan(this," + _ii + ")' class='layui-unselect layui-form-radio " + _id + "'><i class='layui-anim layui-icon layui-icon-radio'></i><div>" + _contentSurveyJson[_ii][0] + "</div></div>";
                                var flag = _contentSurveyJson[_ii][1];
                                if (flag) {
                                    viewSurveyTmp += "<input style='width: 40%' type='text' class='layui-input " + _id + "_" + _ii + "' placeholder='请输入'>";
                                }
                                viewSurveyTmp += "<br>";

                            }
                            viewSurveyTmp += "<hr>";
                        }
                    }
                    $("#content2and3Div").html(viewSurveyTmp);
                    //日期
                    laydate.render({
                        elem: '.layui-date'
                    });

                } else {
                    layer.msg(res.msg);
                    return false;
                }
            });
        });
        //填报日期
        laydate.render({
            elem: '#contentdate'
            , type: 'date'
            , value: null
            , done: function (value) {
                if (value !== null && value !== undefined && value !== "") {
                    contentdate = value;
                } else {
                    contentdate = null;
                }
            }
        });
        //创建日期
        laydate.render({
            elem: '#createTime'
            , type: 'datetime'
            , range: '~'
            , done: function (value, date, endDate) {
                if (value !== null && value !== undefined && value !== "") {
                    startTime = value.split("~")[0];
                    endTime = value.split("~")[1];
                } else {
                    startTime = null;
                    endTime = null;
                }
            }
        });
        var mapArr = {
            'dictId': "1712894076144693250",
        };

        CoreUtil.sendPost("/workflow/log/survey/select", mapArr, function (res) {
            if (res.code === 0) {
                var value = res.data;
                var opt = "<option value = ''>请选择填报类型</option>";
                for (var i in value) {
                    // var contentSurveyJson = eval("(" + value[i].content + ")");
                    opt += '<option value="' + value[i].id + '">' + value[i].title + '</option>';
                }
                $("#mold").html(opt);
                form.render('select'); //需要渲染一下

            } else {
                layer.msg(res.msg);
                return false;

            }
        });
        ajztDms = selectMAjcx({
            //元素容器【必填】
            elem: '#ajztDm'
            //候选数据【必填】
            , data:
                [{"id": "2", "name": "在查"}, {"id": "3", "name": "在审"}, {"id": "4", "name": "在执行"},
                    {"id": "901", "name": "办结"}, {"id": "5", "name": "结案"}
                ]
            //默认值
            , tips: '请选择案件状态'
            //最多选中个数，默认5
            //值的分隔符
            , delimiter: ','
            //候选项数据的键名
            , field: {idName: 'id', titleName: 'name'}
        });

        showTable = table.render({
            elem: '#showTable',
            contentType: 'application/json',
            headers: {
                "authorization": token
            },
            page: true // 开启分页
            ,
            url: '/workflow/activity/list1' //数据接口
            ,
            method: 'POST',
            parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": CoreUtil.isEmpty(res.data) ? 0 : res.data.total, //解析数据长度
                    "data": CoreUtil.isEmpty(res.data) ? null
                        : CoreUtil.paramsDecrypt(res.data.records)
                }
            },
            cols: [[
                {
                    align: 'center',
                    width: 230,
                    field: 'jcajxxuuid',
                    title: '检查UUID',
                    sort: true,
                    hide: true
                }, {
                    fixed: 'right',
                    align: 'center',
                    width: 95,
                    toolbar: "#tool",
                    title: '操作'
                }, {
                    align: 'center',
                    width: 158,
                    field: 'jcajbh',
                    title: '检查案件编号',
                    sort: true,
                }, {
                    align: 'center',
                    width: 158,
                    field: 'ajmc',
                    title: '案件名称',
                    sort: true,
                }, {
                    align: 'center',
                    width: 158,
                    field: 'ajjcztDm',
                    title: '案件状态',
                    sort: true,
                }, {
                    align: 'center',
                    width: 158,
                    field: 'jcry',
                    title: '检查人员',
                    sort: true,
                }, {
                    align: 'center',
                    width: 158,
                    field: 'slry',
                    title: '审理人',
                    sort: true,
                }, {
                    align: 'center',
                    width: 158,
                    field: 'zxry',
                    title: '执行人',
                    sort: true,
                }, {
                    align: 'center',
                    width: 158,
                    field: 'jcxm',
                    title: '检查项目',
                    sort: true,
                }, {
                    align: 'center',
                    width: 158,
                    field: 'nsrmc',
                    title: '纳税人名称',
                    sort: true,
                }, {
                    align: 'center',
                    width: 158,
                    field: 'nsrsbh',
                    title: '纳税人识别号',
                    sort: true,
                }
            ]],
            toolbar: '#toolbar'
        });

        // 列操作
        table.on('tool(showTable)', function (obj) {
            var data = obj.data;
            switch (obj.event) {
                case 'addinspectionhear':
                    addinspectionhear("1", data);
                    break;
            }
        });

        // 个人待办表头工具
        table.on('toolbar(showTable)', function (obj) {
            switch (obj.event) {
                case 'cancel':
                    back();
                    break;
            }
        });

        // 工作日志
        logShowTable = table.render({
            elem: '#logShowTable',
            contentType: 'application/json',
            headers: {
                "authorization": token
            },
            page: true // 开启分页
            ,
            url: '/workflow/log/list' //数据接口
            ,
            method: 'POST',
            parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": CoreUtil.isEmpty(res.data) ? 0 : res.data.total, //解析数据长度
                    "data": CoreUtil.isEmpty(res.data) ? null
                        : CoreUtil.paramsDecrypt(res.data.records)
                }
            },

            cols: [[
                {
                    align: 'center',
                    width: 230,
                    field: 'id',
                    title: '日志编号',
                    sort: true,
                    hide: true
                }, {
                    align: 'center',
                    width: 158,
                    field: 'type',
                    title: '日志类型',
                    sort: true,
                    templet: function (item) {
                        if (item.type == "1") {
                            return "日常日志";
                        } else if (item.type == "2") {
                            return "案件日志";
                        } else {
                            return "未知：" + item.type;
                        }
                    }
                }, {
                    align: 'center',
                    width: 358,
                    field: 'taxPerson',
                    title: '确认人',
                    sort: true,
                }, {
                    align: 'center',
                    width: 158,
                    field: 'createName',
                    title: '创建人',
                    sort: true,
                }, {
                    align: 'center',
                    width: 158,
                    field: 'contentdate',
                    title: '日志日期',
                    sort: true, templet: function (d) {
                        if (!d.contentdate) {
                            return '';
                        }
                        return layui.util.toDateString(d.contentdate, 'yyyy-MM-dd');
                    }
                }, {
                    align: 'center',
                    width: 258,
                    field: 'nsrmc',
                    title: '纳税人名称',
                    sort: true,
                }, {
                    align: 'center',
                    width: 198,
                    field: 'nsrsbh',
                    title: '纳税人识别号',
                    sort: true,
                }, {
                    align: 'center',
                    width: 790,
                    field: 'content1',
                    title: '完成工作',
                    sort: true,
                }, {
                    fixed: 'right',
                    align: 'center',
                    width: 120,
                    toolbar: "#tool1",
                    title: '操作'
                }
            ]],
            toolbar: '#logToolbar'
        });

        // 列操作
        table.on('tool(logShowTable)', function (obj) {
            var data = obj.data;
            switch (obj.event) {
                case 'dellog':
                    console.log(data.id);
                    layer.open({
                        content: '确定要删除么',
                        yes: function (index, layero) {
                            layer.close(index); //如果设定了yes回调，需进行手工关闭
                            CoreUtil.sendPost("/workflow/log/deletelog/" + data.id, null, function (res) {
                                layer.msg(res.msg);
                                searchLog();
                            });
                        }
                    });
                    break;
                case 'editlog':
                    if (!CoreUtil.isEmpty(data.disciplineContent)) {
                        layer.msg("当前日志已经审批不能修改");
                        return false;
                    }
                    if (!CoreUtil.isEmpty(data.sectionchiefContent)) {
                        layer.msg("当前日志已经审批不能修改");
                        return false;
                    }
                    var _type = data.type;
                    var _mold = data.mold;
                    if (_type == "2") {
                        // 案件日志
                        // 查询案件  模板回复
                    } else if (_type == "1") {
                        // 日常日志
                        $("#_tabKey").val("add");
                        $("#content2and3Div").hide();
                        $("#inspectionHearInfo").hide();
                        $(".table_div").hide();
                        $(".table_div1").hide();
                        $(".operation").show();
                        $("#moldDiv").hide();
                        $("#denoWorkDiv").show();
                        $("#contentdate").val(data.contentdate);
                        $("#content1").val(data.content1);
                    } else {
                        layer.msg("日志类型不正确！");
                        return false;
                    }
                    break;
            }
        });

        // 个人待办表头工具
        table.on('toolbar(logShowTable)', function (obj) {
            switch (obj.event) {
                case 'addinspectionhear':
                    addinspectionhear("0");
                    break;
                case 'add':
                    add();
                    break;
            }

        });
        // 个人待办表头工具
        table.on('toolbar(logShowTable)', function (obj) {
            switch (obj.event) {
                case 'addinspectionhear':
                    addinspectionhear("0");
                    break;
                case 'add':
                    add();
                    break;
            }

        });
        // 返回
        $("#btn_cancel").click(function () {
            back();
            return false;
        });

        form.on('submit(saveWorkflowLog)', function (data) {
            var _tabKey = $("#_tabKey").val();
            var url = "";
            if (_tabKey == "add") {
                var content1 = $("#content1").val();
                if (CoreUtil.isEmpty(content1)) {
                    layer.msg("【完成工作】内容未填写！");
                    return false;
                }
                var mapArr = {
                    content1: content1,
                    mold: mold,
                    contentdate: $("#contentdate").val(),
                    relevance: $("#_jcajxxuuid").val(),
                };
                url = "/workflow/log/add";
            } else if (_tabKey == "addinspectionhear") {
                var feelBackArr = [];
                for (var _i in _surveyDetail) {
                    var _optionsTitle = _surveyDetail[_i].optionsTitle;
                    var _optionsConent = _surveyDetail[_i].optionsConent;
                    var _contentSurveyJson = eval("(" + _optionsConent + ")");
                    var _optionsType = _surveyDetail[_i].optionsType;
                    var _id = _surveyDetail[_i].id;
                    var _surveyId = _surveyDetail[_i].surveyId;
                    if (_optionsType == "1") {
                        // 文本
                        var uuid = $("." + _id + "").val();
                        if (CoreUtil.isEmpty(uuid)) {
                            layer.msg(_optionsTitle + "未填写，请填写！");
                            return false;
                        }
                        var map = {
                            surveyId: _surveyId,
                            optionsId: _id,
                            optionsType: _optionsType,
                            optionsTitle: _optionsTitle,
                            feelBack: uuid
                        }
                        feelBackArr.push(map);
                    } else if (_optionsType == "2") {
                        // 多选
                        var _checkedArray = [];
                        var _valueArray = [];
                        for (var _ii in _contentSurveyJson) {
                            var _className = $("." + _id + "")[_ii].className;
                            if (_className.indexOf("layui-form-checked") != -1) {
                                var uuid = _contentSurveyJson[_ii][0];
                                var flag = _contentSurveyJson[_ii][1];
                                if (flag) {
                                    var _text = $("." + _id + "_" + _ii).val();
                                    if (CoreUtil.isEmpty(_text)) {
                                        layer.msg(_optionsTitle + "," + _contentSurveyJson[_ii][0] + "未选择后，未填写！");
                                        return false;
                                    } else {
                                        uuid += "_" + _text;
                                    }
                                }
                                _valueArray.push(uuid);
                            }

                        }
                        var map = {
                            surveyId: _surveyId,
                            optionsId: _id,
                            optionsType: _optionsType,
                            optionsTitle: _optionsTitle,
                            feelBack: _valueArray
                        }
                        feelBackArr.push(map);
                        if (_valueArray.length == 0) {
                            layer.msg(_optionsTitle + "未选择，请选择！");
                            return false;
                        }
                    } else if (_optionsType == "3") {
                        // 单选
                        var _length = $("." + _id).length;
                        var uuid = "";
                        for (_i = 0; _i < _length; _i++) {
                            var _className = $("." + _id)[_i].className;
                            if (_className.indexOf("layui-form-radioed") != -1) {
                                uuid += _contentSurveyJson[_i][0];
                                var flag = _contentSurveyJson[_i][1];
                                if (flag) {
                                    var _text = $("." + _id + "_" + _i).val();
                                    if (CoreUtil.isEmpty(_text)) {
                                        layer.msg(_optionsTitle + "," + _contentSurveyJson[_i][0] + "未选择后，未填写！");
                                        return false;
                                    } else {
                                        uuid += "_" + _text;

                                    }
                                }
                            }
                        }

                        if (CoreUtil.isEmpty(uuid)) {
                            layer.msg(_optionsTitle + ",未选择，未填写！");
                            return false;
                        }

                        var map = {
                            surveyId: _surveyId,
                            optionsId: _id,
                            optionsType: _optionsType,
                            optionsTitle: _optionsTitle,
                            feelBack: uuid
                        }
                        feelBackArr.push(map);
                    }
                }

                if (CoreUtil.isEmpty(mold)) {
                    layer.msg("填报类型未选中!");
                    return false;
                }
                var mapArr = {
                    feelBack: JSON.stringify(feelBackArr),
                    mold: mold,
                    contentdate: contentdate,
                    relevance: $("#_jcajxxuuid").val(),
                }
                url = "/workflow/log/addinspectionhear";
            } else {
                layer.msg("_tabKey不正确！" + _tabKey);
                return false;
            }

            CoreUtil.sendPost(url, mapArr, function (res) {
                if (res.code == '0') {
                    layer.msg("日志填报成功！");
                    back();
                } else {
                    layer.msg(res.msg);
                    return false;
                }
            });
        });

        form.on('submit(search)', function (data) {
            var formData = data.field;
            var ajztDms = formData.ajztDm;
            var nsrmc = $("#nsrmcInput").val();
            var nsrsbh = $("#nsrsbhInput").val();
            var ajbh = $("#ajbhInput").val();
            showTable.reload({
                where: {
                    nsrmc: nsrmc,
                    nsrsbh: nsrsbh,
                    jcajbh: ajbh,
                    ajztDms: ajztDms
                },
                page: {
                    curr: 1
                }
            });
        })
    });

    function search() {
        var nsrmc = $("#nsrmcInput").val();
        var nsrsbh = $("#nsrsbhInput").val();
        var ajbh = $("#ajbhInput").val();

        showTable.reload({
            where: {
                nsrmc: nsrmc,
                nsrsbh: nsrsbh,
                jcajbh: ajbh,
            },
            page: {
                curr: 1
            }
        });
    }

    function searchLog() {
        logShowTable.reload({
            where: {
                type: $("#logType").val(),

                startTime: startTime,
                endTime: endTime,
            },
            page: {
                curr: 1
            }
        });
    }

    function texLength1(obj, id) {
        var curr = obj.value.length;
        if (curr > maxlength) {
            layer.msg('反馈内容字数在' + maxlength + '字以内');
        } else {
            document.getElementById(id).innerHTML = curr;
        }
    }

    function texLength2(obj, id) {
        var curr = obj.value.length;
        if (curr > maxlength) {
            layer.msg('推送原因字数在' + maxlength + '字以内');
        } else {
            document.getElementById(id).innerHTML = curr;
        }
    }

    function add() {
        $("#_tabKey").val("add");
        $("#content2and3Div").hide();
        $("#inspectionHearInfo").hide();
        $(".table_div").hide();
        $(".table_div1").hide();
        $(".operation").show();
        $("#moldDiv").hide();
        $("#denoWorkDiv").show();
    }

    function addinspectionhear(id, data) {
        $("#_tabKey").val("addinspectionhear");
        $("#moldDiv").show();
        if (id == "0") {
            $("#inspectionHearInfo").hide();
            $(".table_div1").show();
            $(".table_div").hide();
            $(".operation").hide();
            $("#denoWorkDiv").show();
        } else if (id == "1") {
            $("#content2and3Div").show();
            $("#content2and3Div").html("");
            $("#denoWorkDiv").hide();
            $("#jcajbh").html("案件编号：" + data.jcajbh);
            $("#_jcajxxuuid").val(data.jcajxxuuid);
            $("#ajmc").val(data.ajmc);
            $("#jcxm").val(data.jcxm);
            $("#nsrmc").val(data.nsrmc);
            $("#nsrsbh").val(data.nsrsbh);
            $("#jcry").val(data.jcry);
            $("#inspectionHearInfo").show();
            $(".table_div1").hide();
            $(".table_div").hide();
            $(".operation").show();
        }
    }

    function back() {
        search();
        searchLog();
        $("#inspectionHearInfo").hide();
        $(".table_div1").hide();
        $(".table_div").show();
        $(".operation").hide();
    }

    function optionsDuoxuan(that, i) {
        var className = $(that)[0].className;
        var classArr = className.split(' ');
        // layui-unselect layui-form-checkbox layui-form-checked
        // layui-unselect layui-form-checkbox b8d9f11209b54e7fab4bcde08d5dabc5
        if (className.indexOf("layui-form-checked") != -1) {
            // 包含
            $(that)[0].className = classArr[0] + ' ' + classArr[1] + ' ' + classArr[2];
        } else {
            // 不包含
            $(that)[0].className = classArr[0] + ' ' + classArr[1] + ' ' + classArr[2] + " layui-form-checked";
        }
        console.log(that);
    }

    function optionsDanxuan(that, i) {
        var className = $(that)[0].className;
        var classArr = className.split(' ');
        // layui-unselect layui-form-radio layui-form-radioed
        // layui-unselect layui-form-radio b8d9f11209b54e7fab4bcde08d5dabc5
        if (className.indexOf("layui-form-radioed") != -1) {
            // 包含
        } else {
            // 不包含
            $(that)[0].className = classArr[0] + ' ' + classArr[1] + ' ' + classArr[2] + " layui-form-radioed";
            var length = $("." + classArr[2]).length;
            for (_i = 0; _i < length; _i++) {
                if (_i != i) {
                    $("." + classArr[2])[_i].className = classArr[0] + ' ' + classArr[1] + ' ' + classArr[2];
                }
            }
        }
        console.log(that);
    }
</script>

</body>
</html>